<?php
require_once('include/inc_database.php');
//require_once('include/inc_useraccount.php');
//require_once('include/inc_recommendation.php');
require_once('include/inc_emailsend.php');

// Open DB connection.
$dbobj = new DatabaseObject();
$dbobj->OpenConnection();

$recID = $_POST['recID'];
$from_email = $_POST['from_email'];
$to_email = $_POST['to_email'];
$send_content = $_POST['send_content'];


$rec_ar = $dbobj->GetResultsAsNestedArray("SELECT * FROM mr_recommendation WHERE recID = " . ValToSQL_num($recID) . " ORDER BY recID DESC", 1);
$rec_r = $rec_ar[0];

$email = new EmailSend();

$email->subject = SiteConst('site_name') . " - Recommendation - " . $rec_r['artist'];
$email->from_email_address = $from_email;
$email->AddRecipient($to_email, "to");
if ($_POST['bcc_from_email'])
	$email->AddRecipient($from_email, "bcc");

$email->body_text = "Someone thinks you'd like this music:";
$email->body_text .= "\nAtrist: " . htmlentities($rec_r['artist']);
if ($rec_r['album'])
	$email->body_text .= "\nAlbum: " . htmlentities($rec_r['album']);
if ($rec_r['song'])
	$email->body_text .= "\nSong: " . htmlentities($rec_r['song']);

$email->body_text .= "\n\nhttp://plurib.us/musicrecommend/rec.php?recID=" . $rec_r['recID'] . "";
$email->body_text .= "\n\nMessage:";
$email->body_text .= "\n" . $send_content;

$email->SendEmail();
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><?=SiteConst('site_name')?></title>

<link rel="shortcut icon" href="images/rec_out02.png" type="image/x-icon">
<meta name="viewport" content="width=700"/>

<style type="text/css">

	@import url('rec.css?<?=$CSS_VERSION?>');

	/* form */
	/*tr.rec_form_row > td {
		padding-bottom: 8px;
	}

	tr.rec_form_row .info_only {
		color: #888;
		font-style: italic;
	}

	tr.rec_form_row .required {
		font-weight: bold;
	}*/


</style>
</head>

<body>

<div id="main">

<h1 style="margin-bottom:10px;">
	<a href="./"><img src="images/logo02.png" align="middle" border="0"/></a>
	<?=SiteConst('site_name')?>
</h1>

	
<div style="margin:0px 15px 20px 5px; border:solid 1px #aaa; padding:10px 6px;">

	Email sent.

	<br/><br/><a href="http://plurib.us/musicrecommend/rec.php?recID=<?=$rec_r['recID']?>">Return to recommendation</a>

</div>

<hr />

<div style="text-align:center; margin:20px auto;">
	Return to <a href="./"><?=SiteConst('site_name')?></a>
	<br/><br/><a href="http://code.google.com/p/mediarecommend/"><img src="images/poweredby_mediarecommend.png" style="border-width:0;"/></a>
</div>

</div>


</body>
</html>
